package com.ticket.sass.provider.dto.output.cinema;

import com.ticket.sass.common.entity.tenant.TicketServerConfigEntity;
import com.ticket.sass.provider.util.GsonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

/**
 * @author ywb
 * @date 2024-03-24 17:31
 */
@Data
@ApiModel
public class TicketServerConfigOutput {
    @ApiModelProperty(value = "售票系统：1 辰星，2 鼎新，3 凤凰云智，4 凤凰佳影，5 火烈鸟，6 vista（沃思达），7 m1905")
    private Short platform;
    
    @ApiModelProperty(value = "票务服务网址")
    private String serverUrl;
    
    @ApiModelProperty(value = "配置内容，json 格式")
    private Object data;
    
    public TicketServerConfigOutput() {
    }
    
    public TicketServerConfigOutput(TicketServerConfigEntity entity) {
        if (Objects.nonNull(entity)){
            this.platform = entity.getPlatform().getValue();
            this.serverUrl = entity.getServerUrl();
            this.data = GsonUtil.getInstance().fromJson(entity.getData(), Object.class);
        }
    }
}
